package com.yksj.healthtalk.entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/**
 * 医师的客户列表 相关资料
 * @author root
 *
 */
public class DoctorClientInfo implements Serializable{

	private String backGold;
	  private String bigIconBackground;
      private String clientIconBackground;
      private String customerAccounts;
      private String customerGold;
      private String customerGroupRel;
      private String customerId;
      private String customerNickname;
      private String customerSex;
      private String distance;
      private String flag;
      private String hasExtensionInfomaiton;
      private String infoVersion;
      private String personalNarrate;
      private String relationType;
      private String roleId;
      private String servicePrice;
      private String serviceStart;
      private String serviceStatus;
      private String serviceStatusCode;
      private String ticketFlag;
	public String getBackGold() {
		return backGold;
	}
	public void setBackGold(String backGold) {
		this.backGold = backGold;
	}
	public String getBigIconBackground() {
		return bigIconBackground;
	}
	public void setBigIconBackground(String bigIconBackground) {
		this.bigIconBackground = bigIconBackground;
	}
	public String getClientIconBackground() {
		return clientIconBackground;
	}
	public void setClientIconBackground(String clientIconBackground) {
		this.clientIconBackground = clientIconBackground;
	}
	public String getCustomerAccounts() {
		return customerAccounts;
	}
	public void setCustomerAccounts(String customerAccounts) {
		this.customerAccounts = customerAccounts;
	}
	public String getCustomerGold() {
		return customerGold;
	}
	public void setCustomerGold(String customerGold) {
		this.customerGold = customerGold;
	}
	public String getCustomerGroupRel() {
		return customerGroupRel;
	}
	public void setCustomerGroupRel(String customerGroupRel) {
		this.customerGroupRel = customerGroupRel;
	}
	public String getCustomerId() {
		return customerId;
	}
	public void setCustomerId(String customerId) {
		this.customerId = customerId;
	}
	public String getCustomerNickname() {
		return customerNickname;
	}
	public void setCustomerNickname(String customerNickname) {
		this.customerNickname = customerNickname;
	}
	public String getCustomerSex() {
		return customerSex;
	}
	public void setCustomerSex(String customerSex) {
		this.customerSex = customerSex;
	}
	public String getDistance() {
		return distance;
	}
	public void setDistance(String distance) {
		this.distance = distance;
	}
	public String getFlag() {
		return flag;
	}
	public void setFlag(String flag) {
		this.flag = flag;
	}
	public String getHasExtensionInfomaiton() {
		return hasExtensionInfomaiton;
	}
	public void setHasExtensionInfomaiton(String hasExtensionInfomaiton) {
		this.hasExtensionInfomaiton = hasExtensionInfomaiton;
	}
	public String getInfoVersion() {
		return infoVersion;
	}
	public void setInfoVersion(String infoVersion) {
		this.infoVersion = infoVersion;
	}
	public String getPersonalNarrate() {
		return personalNarrate;
	}
	public void setPersonalNarrate(String personalNarrate) {
		this.personalNarrate = personalNarrate;
	}
	public String getRelationType() {
		return relationType;
	}
	public void setRelationType(String relationType) {
		this.relationType = relationType;
	}
	public String getRoleId() {
		return roleId;
	}
	public void setRoleId(String roleId) {
		this.roleId = roleId;
	}
	public String getServicePrice() {
		return servicePrice;
	}
	public void setServicePrice(String servicePrice) {
		this.servicePrice = servicePrice;
	}
	public String getServiceStart() {
		return serviceStart;
	}
	public void setServiceStart(String serviceStart) {
		this.serviceStart = serviceStart;
	}
	public String getServiceStatus() {
		return serviceStatus;
	}
	public void setServiceStatus(String serviceStatus) {
		this.serviceStatus = serviceStatus;
	}
	public String getServiceStatusCode() {
		return serviceStatusCode;
	}
	public void setServiceStatusCode(String serviceStatusCode) {
		this.serviceStatusCode = serviceStatusCode;
	}
	public String getTicketFlag() {
		return ticketFlag;
	}
	public void setTicketFlag(String ticketFlag) {
		this.ticketFlag = ticketFlag;
	}
     
	public static List<DoctorClientInfo> parseToList(String content){
		JSONArray jsonArray=null;
		List<DoctorClientInfo> clientInfos=new ArrayList<DoctorClientInfo>();
		try {
			jsonArray=new JSONArray(content);
			for (int i = 0; i < jsonArray.length(); i++) {
				DoctorClientInfo info=new DoctorClientInfo();
				JSONObject object = (JSONObject) jsonArray.get(i);
				info.setBackGold(object.getString("backGold"));
				info.setBigIconBackground(object.getString("bigIconBackground"));
				info.setClientIconBackground(object.getString("clientIconBackground"));
				info.setCustomerAccounts(object.getString("customerAccounts"));
				info.setCustomerGold(object.getString("customerGold"));
				info.setCustomerGroupRel(object.getString("customerGroupRel"));
				info.setCustomerId(object.getString("customerId"));
				info.setCustomerNickname(object.getString("customerNickname"));
				//性别 0--全部 1--男 2--女
				String sex ="";
				if (object.getInt("customerSex") == 1 ) {
					sex = "M";
				}else if(object.getInt("customerSex") == 2){
					sex = "W";
				}else{
					sex="X";
				}
				info.setCustomerSex(sex);
				
				info.setDistance(object.getString("distance"));
				info.setFlag(object.getString("flag"));
				info.setHasExtensionInfomaiton(object.getString("hasExtensionInfomaiton"));
				
				info.setInfoVersion(object.getString("infoVersion"));
				info.setPersonalNarrate(object.getString("personalNarrate"));
				info.setRelationType(object.getString("relationType"));
				info.setRoleId(object.getString("roleId"));
				info.setServicePrice(object.getString("servicePrice"));
				info.setServiceStart(object.getString("serviceStart"));
				
				info.setServiceStatus(object.getString("serviceStatus"));
				info.setServiceStatusCode(object.getString("serviceStatusCode"));
				info.setTicketFlag(object.getString("ticketFlag"));
				clientInfos.add(info);
			}
			
		} catch (JSONException e) {
			return clientInfos;
		}
		
		return clientInfos;
	}
      
}
